# -*- encoding=utf8 -*-
import os
import unittest
from time import sleep

from parameterized import parameterized
from selenium import webdriver

from common.logging_use import init_log_config
from config import BASE_DIR
from page.page_login import PageLogin
from utill import read_json, getDriver


class TestLogin(unittest.TestCase):
    path = BASE_DIR + os.sep +"data" + os.sep + "login.json"
    def setUp(self) -> None:
        # self.options = webdriver.ChromeOptions()
        # self.options.add_experimental_option('detach',True)
        # self.driver = webdriver.Chrome(options=self.options)
        # self.driver.maximize_window()
        self.driver = getDriver.get_driver()
        self.driver.get("https://school.nicezhuanye.com/login/index.html#/loginMain?schoolID=25166186")
        self.login = PageLogin(self.driver)
        # init_log_config(BASE_DIR + '/log/info.log')

    @parameterized.expand(read_json(path,"login"))
    def test01_login(self,username,password):
        try:
            self.login.page_login(username, password)
        except Exception as e:
            print(e)
            raise

